<?php
$title = 'Add Product';
$product_cate_id = 0;
if(!empty($product['id'])){
	$title = 'Edit Product';
	$product_cate_id = $product['category_id'];
}?>
<div id="page-heading"><input type="button" value="Back to Product List" style="float: right;" id="admin-back-product-list"><h1><?php echo $title;?></h1></div>

<form action="<?php echo site_url('admin/save_product'); ?>" method="post" enctype="multipart/form-data">
<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
<tr>
	<th rowspan="3" class="sized"><img src="<?php echo config_item('asset'),'admin/';?>images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
	<th class="topleft"></th>
	<td id="tbl-border-top">&nbsp;</td>
	<th class="topright"></th>
	<th rowspan="3" class="sized"><img src="<?php echo config_item('asset'),'admin/';?>images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
</tr>
<tr>
	<td id="tbl-border-left"></td>
	<td>
	<!--  start content-table-inner -->
	<div id="content-table-inner">
	
	<table border="0" width="100%" cellpadding="0" cellspacing="0">
	<tr valign="top">
	<td align="center">
		<!-- start id-form -->
		<table border="0" cellpadding="0" cellspacing="0"  id="id-form">
		<tr>
			<th valign="top">Product name:</th>
			<?php if (!empty($product['id'])): ?>
				<input type="hidden" name="id" value="<?php echo $product['id']; ?>" id="id">
			<?php endif ?>
			<td><input type="text" class="inp-form" id="title" name="title" value="<?php echo element('title', $product) ?>" /></td>
			<td></td>
		</tr>
		<tr>
			<th valign="top">Slug:</th>
			<td><input type="text" class="inp-form" id="slug" name="slug" value="<?php echo element('slug', $product) ?>" /></td>
			<td>
				<!--<div class="error-left"></div>
			<div class="error-inner">This field is required.</div> -->
			</td>
		</tr>
		<tr>
		<th valign="top">Category:</th>
		<td>	
		<select  class="styledselect_form_1" id="category_id" name="category_id">
			<option value="0">Select Category</option>
			<?php foreach ($categories as $k => $v): ?>
				<option value="<?php echo $v['id']; ?>" <?php echo $v['id'] == $product_cate_id ? ' selected ' : '';?>><?php echo $v['title']; ?></option>
			<?php endforeach ?>
		</select>
		</td>
		<td></td>
		</tr>
	<tr>
		<th valign="top">Description:</th>
		<td colspan="2"><textarea rows="" cols="" class="form-textarea" id="description" name="description"><?php echo element('description', $product) ?></textarea></td>
	</tr>
	<tr>
		<th valign="top">Excerpt:</th>
		<td colspan="2"><textarea rows="" cols="" class="form-textarea" id="excerpt" name="excerpt"><?php echo element('excerpt', $product) ?></textarea></td>
	</tr>
	<tr>
		<th valign="top">Quote:</th>
		<td colspan="2"><textarea rows="" cols="" class="form-textarea" id="quote" name="quote"><?php echo element('quote', $product) ?></textarea></td>
	</tr>
	<tr>
	<th>Image 1:</th>
	<td><input type="file" class="file_1" id="pic1" name="pic1" /></td>
	<td>
	
	</td>
	</tr>
	<tr>
	<th>Image 2:</th>
	<td>  <input type="file" class="file_1" id="pic2" name="pic2" /></td>
	<td></td>
	</tr>
	<tr>
	<th>Image 3:</th>
	<td><input type="file" class="file_1" id="pic3" name="pic3" /></td>
	<td></td>
	</tr>
	<tr>
	<th>Image 4:</th>
	<td><input type="file" class="file_1" id="pic4" name="pic4" /></td>
	<td></td>
	</tr>
	<tr>
	<th>Image 5:</th>
	<td><input type="file" class="file_1" id="pic5" name="pic5" /></td>
	<td></td>
	</tr>
	<tr>
	<th>Image 6:</th>
	<td><input type="file" class="file_1" id="pic6" name="pic6" /></td>
	<td></td>
	</tr>
	<tr>
		<th>&nbsp;</th>
		<td valign="top">
			<input type="submit" value="" class="form-submit" />
<!--			<input type="reset" value="" class="form-reset"  /> -->
		</td>
		<td></td>
	</tr>
	</table>
	<!-- end id-form  -->

	</td>
</tr>
<tr>
</table>
 
<div class="clear"></div>
 

</div>
<!--  end content-table-inner  -->
</td>
<td id="tbl-border-right"></td>
</tr>
<tr>
	<th class="sized bottomleft"></th>
	<td id="tbl-border-bottom">&nbsp;</td>
	<th class="sized bottomright"></th>
</tr>
</table>

</form>
<script type="text/javascript">
$('#admin-back-product-list').click(function(){
	window.location = '<?php echo site_url('admin/product');?>';
});
</script>